package com.zero;

import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;

import javax.inject.Inject;
import javax.ws.rs.*;
import java.io.IOException;

@Path("/weather")
@Consumes("application/json")
@Produces("application/json")
public class WeatherPredictionResource {

    @Inject
    private WeatherService weatherService;

    @GET
    @Path("/currentcity")
    public Uni<String> getCurrentCity() {
        return weatherService.printCity();
    }

    @GET
    @Path("/")
    @Produces("text/plain")
    public Multi<String> getWeatherOfCurrentCity() throws IOException {
        return weatherService.getWeather();
    }

    @GET
    @Path("/{city}")
    @Produces("text/plain")
    public Multi<String> getCityWeather(@PathParam("city") String city) throws IOException {
        return weatherService.getCityWeather(city);
    }

}